<%@ page language="java" import="java.util.*,news.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
    <base href="<%=basePath%>">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<title>新闻发布系统管理后台</title>
	<link href="css/admin.css" rel="stylesheet" type="text/css" />
	
	<style>
		#ncontent{height:100px;width:258px}
	</style>
	
<div id="header">
  <div id="welcome">欢迎使用新闻管理系统！</div>
  <div id="nav">
    <div id="logo"><img src="images/logo.jpg" alt="新闻中国" /></div>
    <div id="a_b01"><img src="images/a_b01.gif" alt="" /></div>
  </div>
</div>
<div id="admin_bar">
  <div id="status">管理员： admin 登录  &#160;&#160;&#160;&#160; <a href="MainServlet">login out</a></div>
  <div id="channel"> </div>
</div>
</head>
<body>


<div id="main">
  <div id="opt_list">
  <ul>
    <li><a href="AddNewsServlet">添加新闻</a></li>
    <li><a href="LoginServlet?uname=admin&upwd=admin&pageNo=1">编辑新闻</a></li>
    <li><a href="AddTopicServlet">添加主题</a></li>
    <li><a href="ShowAllTopicServlet">编辑主题</a></li>
  </ul>
</div>

  <div id="opt_area">
    <h1 id="opt_type"> 编辑新闻： </h1>
    <c:if test="${news.imagePath!=null}">
    	<img src="${news.imagePath}" width="20%"/>
    </c:if>
	<c:set var="ntid" value="${ntid}"></c:set>
    <form action="UpdateNewsServlet?nid=${nid}" method="post" enctype="multipart/form-data">
      <p>
        <label> 主题 </label>
        <select name="ntid">
        	<c:forEach items="${tlist}" var="t">
        		<c:choose>
        			<c:when test="${t.tid==ntid}">
        				<option value="${t.tid}" selected="selected">${t.tname}</option>
        			</c:when>
        			<c:otherwise>
        				<option value="${t.tid}" >${t.tname}</option>
        			</c:otherwise>
        		</c:choose>        	
        	</c:forEach>   	
        </select>
        <input type="hidden" name="nid" value="${nid}" />
      </p>
      <p>
        <label> 标题 </label>
        <input name="ntitle" id="ntitle" type="text" class="opt_input" value="${news.ntitle}">
      </p>
      <p>
        <label> 作者 </label>
        <input name="nauthor" id="nauthor" type="text" class="opt_input" value="${news.nauthor}">
      </p>
      <p>
        <label> 摘要 </label>
        <textarea name="nsummary" id="nsummary" cols="40" rows="3">${news.nsummary}</textarea>
      </p>
      <p>
        <label> 内容 </label>
        <textarea name="ncontent" id="ncontent" cols="70" rows="10">${news.ncontent}</textarea>
      </p>
      <p>
        <label> 上传图片 </label>
        <input name="file" id="file" type="file" class="opt_input" />
      </p>
      <input type="submit" value="提交" class="opt_sub" />
      <input type="reset" value="重置" class="opt_sub" />
    </form>   
    <h1 id="opt_type">
		修改新闻评论：
	</h1>
      <table width="80%" align="left">
      	<c:if test="${clistSize==0}">
      		<td colspan='6'>暂无评论!</td><tr><td colspan='6'><hr /></td></tr>
      	</c:if>
      	<c:forEach items="${clist}" var="c">
      		<td colspan="6" style="font-size:12px;"> 留言人：${c.cauthor}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        	IP:${c.cip}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;留言时间：<fmt:formatDate value="${c.cdate}" pattern="yyyy-MM-dd hh:mm"/><br/>
        	内容：${c.ccontent}%>
        	</td>        	
        	 <tr><td colspan="6"><hr /></td></tr>
      	</c:forEach>
      </table>
  </div>
</div>

<div id="site_link"> <a href="#">关于我们</a><span>|</span> <a href="#">Aboue Us</a><span>|</span> <a href="#">联系我们</a><span>|</span> <a href="#">广告服务</a><span>|</span> <a href="#">供稿服务</a><span>|</span> <a href="#">法律声明</a><span>|</span> <a href="#">招聘信息</a><span>|</span> <a href="#">网站地图</a><span>|</span> <a href="#">留言反馈</a> </div>
<div id="footer">
  <p class="">24小时客户服务热线：010-68988888  &#160;&#160;&#160;&#160; <a href="#">常见问题解答</a> &#160;&#160;&#160;&#160;  新闻热线：010-627488888<br />
    文明办网文明上网举报电话：010-627488888  &#160;&#160;&#160;&#160;  举报邮箱：<a href="#">jubao@jb-aptech.com.cn</a></p>
  <p class="copyright">Copyright &copy; 1999-2009 News China gov, All Right Reserver<br />
    新闻中国   版权所有</p>
</div>
</body>
</html>
